<template>
  <div>
      <el-input class="inputAdd" v-model="name" placeholder="修改用户名"></el-input>
      <el-input class="inputAdd" v-model="pwd" placeholder="修改密码"></el-input>
      <el-button type="warning" @click="update">提交</el-button>
  </div>
</template>
<script>
export default {
  data(){
      return {
          name:this.$route.params.user,
          pwd:''
      }
  },
  methods:{
      update(){
        var params = new URLSearchParams();
        params.append('name', this.name);
        params.append('pwd', this.pwd);
        params.append('user',this.$route.params.user)

        // console.log(`${this.name}/${this.pwd}/${this.$route.params.user}`)
        this.$http.post("http://"+this.IP+"/api/reChange.php",params)
            .then((res)=>{
            if(res.data.code == 20000){
                this.$message.success(res.data.msg)
                this.$router.push('/admin')
            }else{
                this.$message.error(res.data.msg);
            }
        })
      }
  }
}
</script>
<style scoped>
    div{
        margin: 10px;
        width: 30%
    }
</style>
